package com.paginasenlanube.taglib;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;



public class TagConfirmButton extends TagSupport{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String target;
	private String buttonLabel;
	private String confirmText;
	private String confirmButtonLabel;
	private String confirmId;
	
	
	        public int doStartTag() throws JspException {
	        	try {
					pageContext.getOut().print("<section class='remove_tab'>" +
							"<button class='btn btn-danger'  type='submit' data-toggle='modal' data-target='#"+target+"'>"+buttonLabel+"</button>" +
							"</section>");
					pageContext.getOut().print("<!-- Modal -->"+
							"<div class='modal fade' id='"+target+"' tabindex='-1' role='dialog' aria-labelledby='myModalLabel' aria-hidden='true'>"+
								"<div class='modal-dialog'>"+
									"<div class='modal-content'>"+
					        
					        		"<div class='modal-body'>"+
					        			"<h4>"+confirmText+"</h4>"+
					        		"</div>"+
					        		"<div class='modal-footer'>"+
					        			"<button type='button' class='btn btn-default' data-dismiss='modal'>Cancelar</button>"+
					        			"<button type='button' class='btn btn-danger' data-dismiss='modal' id='"+confirmId+"'>"+confirmButtonLabel+"</button>"+
					        		"</div>"+
					        		"</div>"+
					        	"</div>"+
							"</div>");
	        	
	        	} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
		         return SKIP_BODY;
		    }
			
		    public int doEndTag() throws JspException {
		        return EVAL_PAGE;
		    }

			public String getTarget() {
				return target;
			}

			public void setTarget(String target) {
				this.target = target;
			}

			public String getButtonLabel() {
				return buttonLabel;
			}

			public void setButtonLabel(String buttonLabel) {
				this.buttonLabel = buttonLabel;
			}

			public String getConfirmText() {
				return confirmText;
			}

			public void setConfirmText(String confirmText) {
				this.confirmText = confirmText;
			}

			public String getConfirmButtonLabel() {
				return confirmButtonLabel;
			}

			public void setConfirmButtonLabel(String confirmButtonLabel) {
				this.confirmButtonLabel = confirmButtonLabel;
			}

			public String getConfirmId() {
				return confirmId;
			}

			public void setConfirmId(String confirmId) {
				this.confirmId = confirmId;
			}

}
